/**
 * \* Created with IntelliJ IDEA.
 * \* User: 冯若航
 * \* Date: 2021/5/14
 * \* Time: 17:05
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
public class 平方数之和 {
    public boolean judgeSquareSum(int c) {
        int left=1;
        int right= (int) Math.sqrt(c);
        if(right*right==c){
            return true;
        }
        while (left<=right){
            if(left*left+right*right==c){
                return true;
            }else if(left*left+right*right<c){
                left++;
            }else {
                right--;
            }
        }
        return false;
    }
}